/* 
 Copyright 2007 Simon Lebettre
 This file is part of BeanCooker.

 BeanCooker is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.

 BeanCooker is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>
 */
package net.sf.beancooker;

import java.util.Calendar;
import java.util.Date;

import javax.xml.datatype.XMLGregorianCalendar;

/**
 * IDataProvider provides values for data.
 */
@SuppressWarnings("unchecked")
public interface IDataProvider {

	/**
	 * Gets a value for a class : calls the optional init method and then delegates to getValueAfterInit
	 * 
	 * @param clazz
	 *            the class
	 * @param fieldName
	 *            the field name, usefull for adding it to strings values
	 * @param index
	 *            the index, usefull for adding it to strings values or ints
	 * 
	 * @return a new instance of the class with a value.
	 */
	public Object getValue(Class clazz, String fieldName, int index);
	

	/**
	 * Gets a value for a class
	 * 
	 * @param clazz
	 *            the class
	 * @param fieldName
	 *            the field name, usefull for adding it to strings values
	 * @param index
	 *            the index, usefull for adding it to strings values or ints
	 * 
	 * @return a new instance of the class with a value.
	 */
	public Object getValueAfterInit(Class clazz, String fieldName, int index);
	
	/**
	 * Gets a callback to beanfeer. Actually only for access to list of rejected
	 * class, but interesting to have.
	 * 
	 * @return the callback
	 */
	public BeanCooker getCallback();

	/**
	 * Sets the callback.
	 * 
	 * @param aCallback
	 *            the new callback
	 */
	public void setCallback(BeanCooker aCallback);

	/**
	 * Gets the arrays size.
	 * 
	 * @return the arrays size
	 */
	public int getArraysSize();//TODO ? refactor to multiValuedSize

	/**
	 * Sets the arrays size.
	 * 
	 * @param size
	 *            the new arrays size
	 */
	public void setArraysSize(int size);

	/**
	 * Gets the integer value string. Integers will be built with this string
	 * with parseInt like methods
	 * 
	 * @return the integer value string
	 */
	public String getIntegerValueString();

	/**
	 * Gets the decimal value string. decimals will be built with this string
	 * with parseFloat like methods / bigdecimal constructors
	 * 
	 * @return the decimal value string
	 */
	public String getDecimalValueString();

	/**
	 * Gets the string value.
	 * 
	 * @return the string value
	 */
	public String getStringValue();

	/**
	 * Gets the calendar.
	 * 
	 * @return the calendar
	 */
	public Calendar getCalendar();

	/**
	 * Gets the xml calendar.
	 * 
	 * @return the xml calendar
	 */
	public XMLGregorianCalendar getXmlCalendar();

	/**
	 * Gets the date.
	 * 
	 * @return the date
	 */
	public Date getDate();

	/**
	 * Gets the boolean value.
	 * 
	 * @return the boolean value
	 */
	public Boolean getBooleanValue();

	/**
	 * Gets the char value.
	 * 
	 * @return the char value
	 */
	public char getCharValue();

	/**
	 * Gets the byte value string. Byte will be set from this string with a
	 * parse method.
	 * 
	 * @return the byte value string
	 */
	public String getByteValueString();
}
